home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / R&W-NUM.DMO < prev    next >
Text File  |  1996-07-04  |  4KB  |  71 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   R&W-NUM .DMO ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. $INCLUDE "DAS-NB02.INC"
  22. COLOR 7,0
  23. CLS
  24.  
  25. ? "┌────────────────────────────────────────────────────────────────────
  26. ? "│ fWriteB? (Handle%, Value?)                  fReadB?   (Handle%)
  27. ? "│ fWriteW? (Handle%, Value??)                 fReadW??  (Handle%)
  28. ? "│ fWriteI? (Handle%, Value%)                  fReadI%   (Handle%)
  29. ? "│ fWriteL? (Handle%, Value&)                  fReadL&   (Handle%)
  30. ? "│ fWriteD? (Handle%, Value???)                fReadD??? (Handle%)
  31. ? "├──────────────────────────────────────────────────────────────────────
  32. ? "│ These 10 functions will read/write numeric variables directly from/to
  33. ? "│ a file.
  34. ? "│ fWriteX? returns 0 if everything went OK or the DOS error
  35. ? "│ fReadX?  returns the value that has been read
  36. ? "│ They do offer a slight savings in typing, time, and program size but
  37. ? "│ their biggest benefit is in ease of understanding the written code
  38. ? "├─────────────────────────────────────────────────────────────────────────────
  39. ? "│ SEE: FSEEK.TXT
  40. ? "└────────────────────────────────────────────────────────────────────────
  41.                                                   '┌────────────────────────
  42. F$   = "DUMMY.DAT"                                '│ a junk file
  43. B?   = 10                                         '│ some variables
  44. W??  = 20                                         '│
  45. I%   = 30                                         '│
  46. L&   = 40                                         '│
  47. D??? = 50                                         '│
  48.                                                   '│
  49. OPEN "B", #1, F$                                  '│ open the file
  50.   Handle% = FILEATTR( 1, 2 )                      '│ get DOS's file handle
  51.                                                   '│
  52.   fWriteB Handle%, B?                             '│ write the data
  53.   fWriteW Handle%, W??                            '│ PUT$ #1, MKWRD$( W?? )
  54.   fWriteI Handle%, I%                             '│
  55.   fWriteL Handle%, L&                             '│
  56.   fWriteD Handle%, D???                           '│
  57.                                                   '│
  58.   PRINT F$;                                       '│ display file size
  59.   PRINT USING " IS ## BYTES LONG"; LOF(1)         '│
  60.   PRINT                                           '│
  61.   SEEK #1, 0                                      '│ reset file to top
  62.                                                   '│
  63.   PRINT USING "B?   = ##" ; fReadB?  ( Handle% )  '│ GET$ #1, 2, D$
  64.   PRINT USING "W??  = ##" ; fReadW?? ( Handle% )  '│ W?? = CVWRD( D$ )
  65.   PRINT USING "I%   = ##" ; fReadI%  ( Handle% )  '│
  66.   PRINT USING "L_&   = ##"; fReadL&  ( Handle% )  '│
  67.   PRINT USING "D??? = ##" ; fReadD???( Handle% )  '│
  68.                                                   '│
  69. CLOSE #1                                          '│ close the file
  70. fKILLfile F$                                      '│ keep your HD clean!
  71.